<script setup>
import { useApiStore } from '@/stores'
// 在vue3 
import { useRoute,useRouter } from "vue-router"
// 获取路由对象 router useRouter
const router = useRouter()
// 获取路由参数 route useRoute
const route = useRoute()
const goList = () => {
  //console.log(router,route)
  router.push('/goods/list')
 // router.push({ path: '/list' })
}
function toGoodsDetail() {
  router.push({
    path: '/goods/detail/',
    query: {
      goods_id: '122416'
    }
  })
}
const apiStore = useApiStore()
function logout(){
  apiStore.removeAcccessToken()
}




</script>

<template>
<div class="home">
  <button @click="$router.push('/home')">跳首页</button>
  <button @click="toGoodsDetail">跳商品详情页</button>
  <button @click="$router.push('/login')">跳登录页</button>
  <button @click="$router.push('/pinia')">pinia使用页</button>
  <button @click="goList">跳商品列表</button>
  <button @click="$router.push('/')">跳首页</button>
  <button @click="logout">退出</button>
</div>
</template>

<style>

</style>
  